package com.thesis.internet;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class InternetManager {
	private static InternetManager instance = null;

	 public InternetManager() {
	}

	public static void init() {
		if (instance == null) {
			instance = new InternetManager();
		}
	}

	public static InternetManager sharedInstance() {
		if (instance == null) {
			instance = new InternetManager();
		}
		return instance;
	}
	public boolean isInternetConnected(Context context) {
		ConnectivityManager cm = (ConnectivityManager) context
				.getSystemService(Context.CONNECTIVITY_SERVICE);
		NetworkInfo ni = cm.getActiveNetworkInfo();
		boolean result = false;
		if (ni != null) {
			if (ni.getState() == NetworkInfo.State.CONNECTED)
				result = true;
		}
		return result;
	}
}